package com.suian.spring.service.impl;

import com.suian.spring.annotation.Loggable;
import com.suian.spring.aspect.LogAnnotationAspect;
import com.suian.spring.mapper.UserMapper;
import com.suian.spring.service.IUserService;
import com.suian.spring.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IUserServiceImpl implements IUserService, BeanPostProcessor {
    private static final Logger logger = LoggerFactory.getLogger(IUserServiceImpl.class);
    @Autowired
    private UserMapper userMapper;


    @Loggable   //自定义切点
    @Override
    public List<User> getAllUsers() {
        return userMapper.getAllUsers();
    }

//    @Override
//    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
//        logger.info("{}实现了BeanPostProcessor方法",beanName);
//        return bean;
//    }
}
